package com.jd.seg;


public class Segmenter implements ISegmenter{
	
	private RMMSeg rmmSeg = new RMMSeg();
	private MMSeg mmSeg = new MMSeg();
	@Override
	public SegResult seg(String str) {
		SegResult rmmResult = rmmSeg.seg(str);
		SegResult mmResult = mmSeg.seg(str);
		
		System.out.println("rmm:"+rmmResult.getNotLonginWordsCount()+" mm:"+mmResult.getNotLonginWordsCount());
		if(rmmResult!=null&&mmResult!=null){
			if(rmmResult.getNotLonginWordsCount()<=mmResult.getNotLonginWordsCount()){
				return rmmResult;
			}else{
				return mmResult;
			}
		}
		return null;
	}
	
	public static void main(String[] args) {
		Segmenter segmenter = new Segmenter();
		
		String str = "礼品卡使用起来非常方便，您只需按照京东商城的正常购物流程操作,在填写核对订单信息页面中，提交订单按钮的上方选择使用京东礼品卡后录入密码即可，也可将礼品卡绑定到唯一账号使用，就无需每次输入密码";
		for(Word word:segmenter.seg(str).getWords()){
			System.out.print(word.getContent()+"/ ");
		}
	}
	
	
	

}
